// domain/port/BookRepositoryPort.java
package com.library.bookservice.domain.port;

import com.library.bookservice.domain.model.Book;
import com.library.bookservice.domain.exception.BookNotFoundException;
import com.library.bookservice.domain.model.BorrowRecord;

import java.util.List;
import java.util.Optional;

/**
 * 图书仓库端口
 * 定义图书数据访问的契约接口
 */
public interface BookRepositoryPort {
    Book save(Book book);
    Book findById(Long id) throws BookNotFoundException;
    Optional<Book> findByIsbn(String isbn);
    List<Book> findAll();
    List<Book> findByAuthor(String author);
    List<Book> findByGenre(String genre);
    boolean existsByIsbn(String isbn);
    void deleteById(Long id);
}

